package com.qipay.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CpAccountMapper extends com.qipay.baas.mapper.CpAccountMapper {

    @Update({
            "update cp_account",
            "set balance = balance + #{balance,jdbcType=BIGINT},",
            "balance_available = balance_available + #{balanceAvailable,jdbcType=BIGINT},",
            "balance_advance = balance_advance + #{balanceAdvance,jdbcType=BIGINT},",
            "balance_disabled = balance_disabled + #{balanceDisabled,jdbcType=BIGINT},",
            "balance_advance_widthdraw = balance_advance_widthdraw + #{balanceAdvanceWidthdraw,jdbcType=BIGINT} ",
            "where cp_id = #{cpId,jdbcType=BIGINT}"
    })
    void adjust(@Param("cpId") Long cpId,
                @Param("balance") Long balance,//余额
                @Param("balanceAvailable") Long balanceAvailable,//可用余额
                @Param("balanceAdvance") Long balanceAdvance,//垫付余额
                @Param("balanceDisabled") Long balanceDisabled,//不可用余额
                @Param("balanceAdvanceWidthdraw") Long balanceAdvanceWidthdraw);
}